package com.listener.topic;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * <h3>springboot_rabbitmq_listener</h3>
 * <p>Topic交换机接收到的消息RoutingKey必须是多个单词,以.分割</p>
 * Topic交换机与队列绑定时的bindingKey可以指定通配符
 * # : 代表0个或多个词
 * * : 代表1个词
 *
 * @author gdw
 * @since 2024-07-23 09:19:56
 */
@Component
public class RabbitTopicListener {
    @RabbitListener(queues = "topic.queue1")
    public void receive1(String msg) {
        System.out.println("队列一收到的信息是:"+msg);
    }

    @RabbitListener(queues = "topic.queue2")
    public void receive2(String msg) {
        System.out.println("队列二收到的信息是:"+msg);
    }

}
